
import {
    increment,
    decrement,
    addValue,
    syncAddvalue
} from "../store/counterSlice";
import React, { Fragment } from "react";

import { useSelector, useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom"

const Age = () => {
    // 获取仓库数据
    const count = useSelector(state => state.counter.value);
    // 获取修改仓库数据的工具
    const dispatch = useDispatch();
    const navigate = useNavigate()

    function back() {
        navigate(-1)
    }

    function forWord() {
        navigate(1)
    }
    return (
        <div>
            <Fragment>
                <h2 style={{ marginLeft: "50px" }}>React Router Demo</h2>
                <button onClick={forWord}>前进-》</button>
                <button onClick={back}>《-后退</button>
                <hr />
            </Fragment>
        </div>
    );
};

export default Age;

